{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Locations of US Airports\n",
    "========================\n",
    "This is a layered geographic visualization that shows the positions of US\n",
    "airports on a background of US states.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# category: geographic\n",
    "import altair as alt\n",
    "alt.data_transformers.enable('json')\n",
    "from vega_datasets import data\n",
    "\n",
    "states = alt.topo_feature(data.us_10m.url, feature='states')\n",
    "airports = data.airports.url\n",
    "\n",
    "# US states background\n",
    "background = alt.Chart(states).mark_geoshape(\n",
    "    fill='lightgray',\n",
    "    stroke='white'\n",
    ").properties(\n",
    "    width=500,\n",
    "    height=300\n",
    ").project('albersUsa')\n",
    "\n",
    "# airport positions on background\n",
    "points = alt.Chart(airports).mark_circle().encode(\n",
    "    longitude='longitude:Q',\n",
    "    latitude='latitude:Q',\n",
    "    size=alt.value(10),\n",
    "    color=alt.value('steelblue')\n",
    ")\n",
    "\n",
    "background + points\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "env": {},
   "interrupt_mode": "signal",
   "language": "python",
   "metadata": {},
   "name": "python3"
  },
  "language": "python"
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
